<template>
  <div>
    <div class="list">
      <h2>{{myActivity.title}}</h2>
      <ul>
        <li>
          <span class="s1">活动时间:</span>
          <div class="s2">{{myActivity.startTime}}--{{myActivity.endTime}}</div>
        </li>
        <li>
          <span class="s1">活动地点:</span>
          <div class="s2">{{myActivity.local}}</div>
        </li>
        <li>
          <span class="s1">需求说明:</span>
          <div class="s2">{{myActivity.need}}</div>
        </li>
        <li>
          <span class="s1">报名人数:</span>
          <div class="s2">{{myActivity.numbered}}/{{myActivity.number}}</div>
        </li>
        <li>
          <span class="s1">联系方式:</span>
          <div class="s2">{{myActivity.phone}}</div>
        </li>
        <li>
          <span class="s1">发布人:</span>
          <div class="s2">{{ myActivity.name }}</div>
        </li>
        <li>
          <span class="s1">服务组织:</span>
          <div class="s2">{{myActivity.detail}}</div>
        </li>
      </ul>
    <button @click="cancel" :disabled="disabled">取消活动</button>
    </div>
  </div>
</template>


<script>
  import request from '../../utils/request'
  export default{
    data(){
      return {
        myActivity:'',
        disabled:false
      }
    },
    methods: {
      async cancel(){
        let id = this.myActivity._id
        let result = await request('/activity/myCancel',{id},'GET')
        if(result1.n==1){
          wx.showToast({
            title: '活动取消成功',
            duration: 5000
          })
            this.disabled = true
          }
      }
    },
    async mounted() {
      let data = JSON.parse(this.$mp.query.myActivity)
      this.myActivity = data
      
    },
  }
</script>

<style scoped>
.list{
  width:100%;
  height:100%;
}
.list h2{
  color:red;
  text-align: center;
}
.list ul li{
  margin:40px 0;
  border-bottom: 1px solid rgb(202, 194, 194);
  padding-bottom: 20px;
  overflow:hidden;
}
.list ul li .s1{
  margin-left: 20px;
  color: red;
}
.list ul li .s2{

  width:220px;
  float: right;
  margin-right:20px;
  font-size:17px;
  color:rgb(146, 128, 128)
}
button{
  background-color:red;
}
</style>
 